package main

import (
    "fmt"
    "time"
    "adkr/pkg/turritopsis"
    "adkr/pkg/adkr"
)

func main() {
    r := turritopsis.NewInMemoryRouter(16)
    in, out := r.KRChannels(0)
    // send one message
    go func() {
        m := adkr.Message{Tag: "TEST", Round: 0, Sender: 0, Payload: []byte("hello")}
        out <- m
    }()
    select {
    case m := <-in:
        fmt.Printf("inmem router received: tag=%s round=%d sender=%d payload=%s\n", m.Tag, m.Round, m.Sender, string(m.Payload))
    case <-time.After(1 * time.Second):
        panic("timeout waiting for inmem router message")
    }
}




